/**
 * @author Nicolas Zimerman (zimerman@usi.ch)
 * @author Isabella Nake (isabella.nake@usi.ch)
 * @author Nicolas Lusa (lusan@usi.ch)
 * @author Nicolas Latorre (nicolas.latorre@usi.ch)
 */
package ch.usi.inf.pf2.circuit;

import java.io.Serializable;
import java.util.ArrayList;

public class OutputPin implements Serializable{
	private static final long serialVersionUID = 2319913431489861101L;
	private Value value;
	private ArrayList<Wire> wires;
	
	public OutputPin() {
		value = Value.UNKNOWN;
		this.wires = new ArrayList<Wire>();
	}
	
	//MODEL PART
	
	public void setValue(final Value value) {
		System.out.println("outputPin: " + this);
		this.value = value;
		for(Wire wire: wires) {
			wire.setValue(value);
		}
	}
	
	public Value getValue() {
		return value;
	}
	
	public void addWire(final Wire wire) {
		this.wires.add(wire);
	}

	public void removeWire(Wire wire) {
		wires.remove(wire);
	}

}
